package doc.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author eollse-wj
 * @ClassName RichTextUtil
 * @date 2019/12/4
 * @description 富文本处理
 */
public class RichTextUtil {
    public static String getImages(String content) {
        String images = "";
        if (!StringUtil.isEmpty(content)) {
            String rule = "img(.*?)src=\"(.*?)\"";
            Pattern p1 = Pattern.compile(rule);
            Matcher m = p1.matcher(content);
            String pic = "";
            while (m.find()) {
                pic += m.group(2) + ",";
            }
            if (pic.length() > 0) {
                images = pic.substring(0, pic.length() - 1);
            }
        }
        return images;
    }
}
